package com.jz.main.io.queue;

import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class BlockingQueueTest {
    public static void main(String[] args) throws InterruptedException {
        LinkedBlockingQueue<Integer> lbq = new LinkedBlockingQueue<>(2);
        ArrayBlockingQueue<Integer> abq = new ArrayBlockingQueue<>(2);
        ArrayList l = new ArrayList();
        lbq.put(1);
        lbq.put(2);
        Timer t = new Timer();
        t.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println(lbq.poll());
            }
        },8000);

        lbq.put(3);
        System.out.println("====");
        System.out.println("12131");
        System.out.println(lbq);
        System.out.println(lbq.poll());
        System.out.println(lbq.poll());
        System.out.println(lbq.poll());
        t.cancel();
    }
}
